package com.esri.core.portal;

import com.esri.core.internal.util.d;
import com.esri.core.runtime.LicenseImpl;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class LicenseInfo {
    private static final String a = "expDate";
    private long b;
    private String c;
    private PortalInfo d;
    private LicenseImpl e;

    private LicenseInfo(String str) {
        this.b = 0L;
        this.d = null;
        if (str == null || str.isEmpty()) {
            this.c = "Invalid";
        } else {
            this.c = str;
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public LicenseInfo(PortalInfo portalInfo) {
        this.b = 0L;
        this.d = null;
        this.d = portalInfo;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void a(JsonParser jsonParser) throws Exception {
        if (d.c(jsonParser)) {
            jsonParser.enable(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS);
            jsonParser.enable(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS);
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String currentName = jsonParser.getCurrentName();
                jsonParser.nextToken();
                if (currentName.equals(a)) {
                    this.b = jsonParser.getLongValue();
                } else {
                    jsonParser.skipChildren();
                }
            }
        }
    }

    public String toJson() {
        String str = this.c;
        if (str == null || str.length() == 0) {
            this.c = b().a(a(), this.b);
        }
        return this.c;
    }

    public static LicenseInfo fromJson(String str) {
        return new LicenseInfo(str);
    }

    private boolean a() {
        PortalInfo portalInfo = this.d;
        if (portalInfo == null) {
            return false;
        }
        return portalInfo.a();
    }

    private LicenseImpl b() {
        if (this.e == null) {
            this.e = new LicenseImpl();
        }
        return this.e;
    }
}
